package com.yc.navy.blog.blog.controller;

import com.yc.navy.blog.blog.bean.TypeInfo;
import com.yc.navy.blog.blog.enums.ResultEnum;
import com.yc.navy.blog.blog.service.ITypeInfoService;
import com.yc.navy.blog.blog.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/type")
public class TypeInfoController {
    @Autowired
    private ITypeInfoService typeInfoService;
    @GetMapping("/list")
    public ResultVo list(){
        List<TypeInfo> list=typeInfoService.list();
        if (list==null||list.isEmpty()){
            return new ResultVo(ResultEnum.DATA_NULL);
        }
        return new ResultVo(ResultEnum.SUCCESS,list);
    }
}
